package com.zret.oasys.operation.dept;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;
import com.zret.oasys.entity.Dept;

public class GetDept implements DeptServletOperation {

	@Override
	public void doOperation(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 获取所有部门的方法
		response.setContentType("application/json;charset=utf-8");
		List<Dept> list = deptservice.getDepts();
		PrintWriter out = response.getWriter();
		Gson gson = new Gson();
		String jsonObj = gson.toJson(list);
		System.out.println(jsonObj);
		out.print(jsonObj);
		out.close();
	}

}
